<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div sec:authorize="!isAuthenticated()">
    <a th:href="@{/login}"> 请登录</a>
</div>

<div sec:authorize="isAuthenticated()">
    <span sec:authentication="name"></span>
    <span sec:authentication="principal.authorities"></span>
    <span sec:authorize="hasRole('VIP1')">vip1</span>
    <a th:href="@{/logout}"> 请登录</a>
</div>

</body>
</html>